#ifndef _NON_PRIMITIVES
#define _NON_PRIMITIVES
#include "../SceneGraph.h"

#include <GL/glut.h>

class BezierObject: public Geode {
public:
	float *rotated_vertices;
	float *normals;
	float *texture_coords;
	BezierObject();
	void render();
	void boundingSphere(Matrix4 *c, Texture *t);
private:
	Texture *t;
	Matrix4 *G, *B, *C;
	Vector4 *T;
	Vector4 x(float t);
	Vector4 *n;
	void getBezierSurface(int segments, float control_points[],
			int no_curve_points, float angle_inc);
	Vector3* normal(float u, float v);
};

class BezierPatch: public Geode {
public:
	BezierPatch();
	void render();
	void boundingSphere(Matrix4 *c, Texture *t);
	float *normals;
private:
	Matrix4 *Gx, *Gy, *Gz, *Cx, *Cy, *Cz, *B, *Utemp, *Vtemp;
	Vector4 *U, *V;
	Vector3 *res, *res1, *res2;
	Texture *t;
	Vector3* x(float u, float v);
	Vector3* normal(float u, float v);
	Vector3 *vec;
	int size;
	float step;
	float tmp;
	float tstep;
	float *vertices;
	void makeBezierPatch();
};

class BezierPatch2: public Geode {
public:
	BezierPatch2();
	void render();
	void boundingSphere(Matrix4 *c, Texture *t);
	float *normals;
private:
	Matrix4 *Gx, *Gy, *Gz, *Cx, *Cy, *Cz, *B, *Utemp, *Vtemp;
	Vector4 *U, *V;
	Vector3 *res, *res1, *res2;
	Texture *t;
	Vector3* x(float u, float v);
	Vector3* normal(float u, float v);
	Vector3 *vec;
	int size;
	float step;
	float tmp;
	float xstep, ystep;
	float *vertices;
	float wave;
	float speed;
	bool goingPlus;
	void animate();
	void makeBezierPatch();
};
#endif

